package cn.yougou.controller;

import cn.yougou.common.DtoUtil;
import cn.yougou.dto.Dto;
import cn.yougou.dto.Query;
import cn.yougou.service.admin.YgAdminAddressService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

/**
 * (YgAdminAddress)表控制层
 *
 * @author 白杰崇
 * @since 2020-12-03 01:32:19
 */
@RestController
@RequestMapping("YgAdminAddress")
public class YgAdminAddressController {


    @Reference
    private YgAdminAddressService ygAdminAddressService;

    /**
     * 查询全部商品(分页)
     * @return
     */
    @GetMapping("/seleAll")
    public Dto seleAll(Integer page,Integer limit,String sort,String order,Integer id,String name){
        Query query =new Query();

        //计算当前从多少条展示
        query.setSort(sort);
        query.setOrder(order);
        query.setName(name);
        query.setId(id);
        query.setPage((page-1)*limit);
        query.setLimit(limit);
        //根据条件查询总条数赋值给query
        query.setInfoCount(ygAdminAddressService.selNum(query));
        return DtoUtil.returnDataListSuccess(ygAdminAddressService.seleAll(query),query);
    }

}
